package com.m3958.firstgwt.client.datasource;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.m3958.firstgwt.client.constants.XinJianFieldConstants;
import com.m3958.firstgwt.client.types.XinJianField;
import com.m3958.firstgwt.shared.type.CommonField;
import com.smartgwt.client.data.fields.DataSourceBooleanField;
import com.smartgwt.client.data.fields.DataSourceDateField;
import com.smartgwt.client.data.fields.DataSourceDateTimeField;
import com.smartgwt.client.data.fields.DataSourceTextField;


@Singleton
public class XinJianDataSource extends BaseDataSource{

    public static String className = "com.m3958.firstgwt.server.model.XinJian";

	
    @Inject
    public XinJianDataSource(DsErrorHandler deh,XinJianFieldConstants constants) {
    	setID("xinJianDS");

        DataSourceTextField titleField = new DataSourceTextField(CommonField.TITLE.getValue(),constants.title());
        DataSourceTextField contentField = new DataSourceTextField(CommonField.CONTENT.getValue(),constants.content());
        DataSourceTextField replyField = new DataSourceTextField(XinJianField.REPLY.getValue(),constants.reply());
        DataSourceTextField xingmingField = new DataSourceTextField(XinJianField.XINGMING.getValue(),constants.xingming());
        DataSourceTextField xingbieField = new DataSourceTextField(XinJianField.XINGBIE.getValue(),constants.xingbie());
        DataSourceDateField shengriField = new DataSourceDateField(XinJianField.SHENGRI.getValue(),constants.shengri());
        DataSourceDateTimeField publishedAtField = new DataSourceDateTimeField(CommonField.PUBLISHED_AT.getValue(),constants.publishedAt());
        DataSourceDateTimeField repliedAtField = new DataSourceDateTimeField(XinJianField.REPLIED_AT.getValue(),constants.repliedAt());
        DataSourceTextField shoujiField = new DataSourceTextField(XinJianField.SHOUJI.getValue(),constants.shouji());
        DataSourceTextField emailField = new DataSourceTextField(CommonField.EMAIL.getValue(),constants.email());
        DataSourceTextField dianhuaField = new DataSourceTextField(XinJianField.DIANHUA.getValue(),constants.dianhua());
        DataSourceTextField dizhiField = new DataSourceTextField(XinJianField.DIZHI.getValue(),constants.dizhi());
        DataSourceTextField leixingField = new DataSourceTextField(XinJianField.LEIXING.getValue(),constants.leixing());
        DataSourceTextField youbianField = new DataSourceTextField(XinJianField.YOUBIAN.getValue(),constants.youbian());
        DataSourceTextField baomimaField = new DataSourceTextField(XinJianField.BAOMIMA.getValue(),constants.baomima());
        
        DataSourceBooleanField gongkaiField = new DataSourceBooleanField(XinJianField.GONGKAI.getValue(),constants.gongkai());
        DataSourceBooleanField auditField = new DataSourceBooleanField(CommonField.AUDIT.getValue(),constants.audit());
        addHandleErrorHandler(deh);
        
        setFields(getIdField(),getVersionField(),titleField,contentField,replyField,getCreatedAtField(false,constants),xingmingField,xingbieField,
        		shengriField,shoujiField,emailField,dianhuaField,dizhiField,leixingField,youbianField,baomimaField,
        		gongkaiField,auditField,publishedAtField,repliedAtField,getTplNameField());
        setClientOnly(false);
       
    }

	@Override
	protected String getModelClassName() {
		return className;
	}

}
